<?php if(is_array($items) && !empty($items)){?>
<?php 
$i=0;
$k=0;
$items_ = array();
foreach ($items as $key => $photo) {
	$k++;
	$items_[$i][$k] = $photo; 
	if($k>=3){
		$k = 0;	
		$i++;
	}
}
?>
<div  id="features">

<?php foreach ($items_ as $key => $group) {?>
<dl class="gallery">
	<?php foreach ($group as $jj => $photo) {?>
	<dt class="corners">	
		<?php $thumb = $this->Html->url('/', true).str_replace(' ',"%20",$fileUpload->image($photo['StoreUpload']['name'],array('autoResize'=>true,'width'=>$params['width'],'imagePathOnly'=>true)));?>
		<?php echo $this->Html->link("&nbsp;", array('plugin'=>'store','controller'=>'products','action' => 'view', $photo['StoreProduct']['id'],Inflector::slug($photo['StoreProduct']['name'],'-')),array('escape'=>false,'class'=>"highslide", 'title'=>$photo['StoreProduct']['name'], 'style'=>"background: url(".$thumb.") center no-repeat;")); ?>
	</dt>
	<?php }?>
</dl>
<?php }?>
</div>
<?php
echo $javascript->codeBlock("
	$(document).ready(function(){ $('#features').jshowoff({autoPlay: true}); });
",$options = array('allowCache'=>false,'safe'=>false,'inline'=>false));
?>


<?php 
$this->Html->styleBlock("
	dl.gallery { position: relative;}
	dl.gallery dt { display: inline; width: ".($params['width']+33)."px; margin: {$params['margin']}px; z-index: 90;}
	dl.gallery dt:hover { background: url(../../img/".HOST."/bg_thumb.jpg) center no-repeat; }
	dl.gallery dt a.highslide { display: block; text-decoration:none; width: ".($params['width']+10)."px; height: ".($params['height']+10)."px; padding: {$params['padding']}px;  border: solid {$params['border']}px #d2d2d2; background-position: center; background-repeat: no-repeat; float: left; overflow: hidden;}
	dl.gallery dt a.highslide:hover { padding: {$params['padding']}px;  }
	dl.gallery dt a.link-more { display: block; text-align: right; color: #fff; font-size: 14px;  text-decoration: none; background: url(../../../img/".HOST."/button.png) top left no-repeat;    border: none; background-position: center; background-repeat: no-repeat; float: left; overflow: hidden;}
	dl.gallery dt a.link-more { width: 130px; height: 22px; margin: 0px; padding: 5px 30px 0px 0px; }
",array('inline'=>false));
?>
<?php }?>